package database;

public class dbGameImpl implements database.ints.dbGame {

	dbMain dbM=new dbMain();
	private String result;
	private String gameID = "gid";
	private String gameAbility = "gabil";
	private String gameDmg = "gdmg";
	
	@Override
	public void createGame() {
		dbM.addGame(gameAbility, gameDmg);
	}

	@Override
	public void closeGame(int gID) {
		dbM.dropTable(dbM.URL_GAME, gameID, gID);
	}
	
	@Override
	public int getAbility(int cID) {
		result = dbM.getValue(dbM.URL_GAME, gameID, Integer.toString(cID), gameAbility);
		return Integer.parseInt(result);
	}
	
	@Override
	public int getDmg(int cID) {
		result = dbM.getValue(dbM.URL_GAME, gameID, Integer.toString(cID), gameDmg);
		return Integer.parseInt(result);
	}
	
	@Override
	public void setAbility(int cID, int abil) {
		dbM.updateValue(dbM.URL_GAME, gameID, Integer.toString(cID), gameAbility, Integer.toString(abil));
	}

	@Override
	public void didDmgTo(int cID, int dmg) {
		dbM.updateValue(dbM.URL_GAME, gameID, Integer.toString(cID), gameDmg, Integer.toString(dmg));
	}

	@Override
	public int[] getMyChars(int playerID) {
		// Will not be implemented in the alpha
		return new int[1];
	}
}
